﻿#ifndef AUDIO_DEV_H
#define AUDIO_DEV_H

#include <QObject>
#include <QIODevice>
#include <QAudioInput>
#include <QAudioDeviceInfo>
#include <QFile>
#include <QCoreApplication>

class Audio_dev : public QObject
{
    Q_OBJECT
public:
    explicit Audio_dev(QObject *parent = nullptr);
    void start_record();
    void stop_record();
    QList<QAudioDeviceInfo>& AvailableAudioDevs();
    void dev_change(int index);
signals:
    void msg_to_ui(const QString& content);
private:
    QAudioInput* audio_dev = nullptr;
    QAudioDeviceInfo cur_dev;
    QList<QAudioDeviceInfo> audiodevlist;   //音频输入设备列表
    QFile* data_dev = nullptr;
    QAudioFormat AudioFormat;
};

#endif // AUDIO_DEV_H
